<?php

namespace App\Listeners\Train\TrainOrder\Refund;

use App\Events\Train\TrainOrder\Refund\TicketReturnFailedEvent;
use App\Models\Train\TrainOrderPassengers\Repositories\Interfaces\TrainOrderPassengersRepositoryInterface;

class TicketReturnFailedListener
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param object $event
     *
     * @return void
     */
    public function handle(TicketReturnFailedEvent $event)
    {
        /**
         * @var TrainOrderPassengersRepositoryInterface $orderPassengerRepo
         */
        $orderPassengerRepo = app(TrainOrderPassengersRepositoryInterface::class);
        $orderPassengerRepo->ticketReturnFailed($event->passenger, $event->refund_info, $event->failed_reason);

    }
}
